<template>
	<view class="detail">
		<view class="img">
			<image :src="detailInfo.image" mode=""></image>
		</view>
		<view class="title">
			<text>{{detailInfo.title}}</text>
		</view>
		<view class="time">
			<text>{{detailInfo.date | getTime}}</text>
		</view>
		<view class="content">
			<text>{{detailInfo.content}}</text>
		</view>
	</view>
</template>

<script>
	import {
		getDynamicDetail
	} from "@/common/request.js"
	import {formatDate} from '@/common/utils.js'

	export default {
		data() {
			return {
				id: '',
				detailInfo: {}
			}
		},
		filters:{
			getTime(time){
				let date = new Date(time)
				return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
			}
		},
		methods: {
			getDynamicDetailMsg() {
				getDynamicDetail(this.id).then(res => {
					this.detailInfo = res
				})
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDynamicDetailMsg()
		},
		created() {}
	}
</script>

<style lang="scss">
	.detail{
		margin: 40rpx 30rpx;
		.img{
			margin-bottom: 30rpx;
		}
		.title{
			margin-bottom: 30rpx;
			text-align: center;
		}
		.time{
			margin-bottom: 30rpx;
			text-align: center;
		}
		.content{
			margin-bottom: 30rpx;
		}
	}
</style>
